from threading import Thread
import time

g_num = 0


def test1():
    global g_num
    for i in range(1000000):
        g_num += 1

    print("---test1---g_num=%d" % g_num)


def test2():
    global g_num
    for i in range(1000000):
        g_num += 1

    print("---test2---g_num=%d"%g_num)




t1 = Thread(target=test1)
t1.start()

 #取消屏蔽之后 再次运行程序，结果会不一样，，，为啥呢？不会出现正确的结果
time.sleep(3)

t2 = Thread(target=test2)
t2.start()
